//
//  JLRequest.swift
//  JLApiCenter
//
//  Created by Jiang Chencheng on 2024/7/31.
//

import Foundation
import Alamofire


/// 请求体
/// GET(#path#, #parameters#), path: 路径，parameters：参数
/// POST(#path#, #parameters#), path: 路径，parameters：参数
public enum JLRequest  {
    case GET(String, [String: String])
    case POST(String, [String: String])
}

extension JLRequest: JLRequestable {
    
    public var method: HTTPMethod {
        switch self {
        case .GET: return .get
        case .POST: return .post
        }
    }

    public var path: String {
        switch self {
        case let .GET(path, _):
            return path
        case let .POST(path, _):
            return path
        }
    }
    
    public var parameters: [String : String] {
        switch self {
        case let .GET(_,parameters):
            return parameters
        case let .POST(_, parameters):
            return parameters
        }
    }
    
}

